@extends("admin.base")
@section("contents")
<div class="row mt-5">
    <div class="col-lg-4 mt-5 m-auto">
        <div class="card mb-3" style="border-radius: 10px">
            <div class="card-body w-100  " >
                <h3 style="text-align: center" class="danger">添加类型页面</h3>
                <form id="typeform" method="post">
                    <div class="m-auto  col-10 ">
                    <div class="row">
                        <div class="col-10 m-auto">
                            <div class="mb-3">
                                <label class="form-label" for="default-input">类型（汉）</label>
                                <input class="form-control " type="text" name="type_ch"  value="{{isset($ok)?$ok->type_ch:''}}">
                                <input class="form-control " type="hidden" name="id"  value="{{isset($ok)?$ok->id:''}}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-10 m-auto">
                            <div class="mb-3">
                                 <label class="form-label" for="default-input">类型（维）</label>
                                 <input class="form-control" type="text" name="type_uy" value="{{isset($ok)?$ok->type_uy:''}}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-10 m-auto">
                            <div class="mb-3">
                                <label class="form-label" for="default-input">排序</label>
                                <input class="form-control" type="text" name="order" value="{{isset($ok)?$ok->order:''}}">
                            </div>
                        </div>
                    </div>
                    </div>
                </form>
                <div class="col-4 m-auto">
                    <button onclick="typesubmit()" class="btn btn-outline-info">提交</button>
                    &nbsp; &nbsp; &nbsp;
                    <button type="reset" class="btn btn-outline-danger">重置</button>
                </div>
                    </div>
            </div>
        </div>
    </div>
@endsection


@section("scripts")

    <script>
function typesubmit() {

    var data = $("#typeform").serialize()
    $.ajax({
        url: "typeinsert",
        dataType: "json",
        data: data,
        async: true,
        type:"POST",
        headers:{'X-CSRF-TOKEN':'{{csrf_token()}}'},
        success: function (req) {
            swal({
                title: "操作成功",
                text: req.title,
                icon: "success",
                button: "知道了",
            })
        },
    })
}
    </script>
@endsection
